package metalink.admin;

import java.io.File;
import java.util.ArrayList;

import vo.BatchDetailsVo;
import vo.Placementvo;
import vo.TimeTableVo;

import com.opensymphony.xwork2.ActionSupport;
import model.admin.*;
public class TimeTable extends ActionSupport{
	int batch_id;
	String subject;
	File attached_file; 
	String file_name;
	String value="";
	int attachment_id;
	String select_batch_timetable;
	ArrayList<BatchDetailsVo> batch = new ArrayList<BatchDetailsVo>();
	ArrayList<TimeTableVo> timetable = new ArrayList<TimeTableVo>(); 
	
	public String execute()throws Exception{
		TimeTableMo mo = new TimeTableMo();
		if(value.contentEquals("updatetimetable")){
			//System.out.println(select_batch_timetable);
			//batch_id=Integer.parseInt(select_batch_timetable);
		mo.uploadTimeTable(batch_id, subject, attached_file, file_name,value);
		batch=mo.getBatchList();
		timetable = mo.getTimeTableList();
		}else if(value.contentEquals("viewtimetable")){
		batch=mo.getBatchList();
		timetable = mo.getTimeTableList();
		}else if(value.contentEquals("deletetimetable")){
			mo.deleteTimeTable(attachment_id);
			batch=mo.getBatchList();
			timetable = mo.getTimeTableList();
		}
		return SUCCESS;
		
	}
	
	public String getSelect_batch_timetable() {
		return select_batch_timetable;
	}

	public void setSelect_batch_timetable(String select_batch_timetable) {
		this.select_batch_timetable = select_batch_timetable;
	}

	public int getAttachment_id() {
		return attachment_id;
	}

	public void setAttachment_id(int attachment_id) {
		this.attachment_id = attachment_id;
	}

	public ArrayList<TimeTableVo> getTimetable() {
		return timetable;
	}

	public void setTimetable(ArrayList<TimeTableVo> timetable) {
		this.timetable = timetable;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public int getBatch_id() {
		return batch_id;
	}
	public void setBatch_id(int batch_id) {
		this.batch_id = batch_id;
	}
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public File getAttached_file() {
		return attached_file;
	}
	public void setAttached_file(File attached_file) {
		this.attached_file = attached_file;
	}
	public String getFile_name() {
		return file_name;
	}
	public void setFile_name(String file_name) {
		this.file_name = file_name;
	}
	public ArrayList<BatchDetailsVo> getBatch() {
		return batch;
	}
	public void setBatch(ArrayList<BatchDetailsVo> batch) {
		this.batch = batch;
	}

}
